package guoanmaker.provider.business.service;

import java.util.Arrays;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import guoanmaker.provider.business.model.ProvideSpacefacilities;
import guoanmaker.provider.business.repository.ProvideSpacefacilitiesRepository;
/**
 * 
 * @author 
 *
 */

@Service
public class ProviderSpacefacilitiesService implements ProviderSpacefacilitiesServiceInterface {

	@Autowired
	private ProvideSpacefacilitiesRepository ProvideSpacefacilitiesRepository;
	@Override
	public List<ProvideSpacefacilities> selectAllSpacefacilities() {
		// TODO Auto-generated method stub
		return ProvideSpacefacilitiesRepository.findAll();
	}
	@Override
	public ProvideSpacefacilities insertSpacefacilities(ProvideSpacefacilities provideSpacefacilities) {
		// TODO Auto-generated method stub
		return ProvideSpacefacilitiesRepository.save(provideSpacefacilities);
	}
	@Override
	public List<ProvideSpacefacilities> selectSpacefacilitiesByIds(String ids) {
		ids=ids==null?"":ids;
		List<ProvideSpacefacilities> spacefacilities=null;
		if(!ids.equals("")){
			List<String> userList = Arrays.asList(ids.split(","));
			spacefacilities=ProvideSpacefacilitiesRepository.findByIdIn(userList);
		}
		return spacefacilities;
	}

	
}
